package uy.com.csi.gestpro.util;

import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class ServiceLocator {
	@SuppressWarnings("rawtypes")
	final Hashtable jndiProperties = new Hashtable();

	@SuppressWarnings("unchecked")
	public ServiceLocator() {
		jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
	}

	public Object findServiceRemote(String nombreBean, String nombreBeanRemoto) {
		Object obj = null;
		try {
			Context context = new InitialContext(jndiProperties);
			obj = context.lookup("ejb:ear_gestpro/ejb1_gestpro//" + nombreBean + "!" + nombreBeanRemoto);
		} catch (NamingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return obj;
	}
}
